<?php

namespace App\Http\Requests\Administrator;


class GameListRequest extends Request
{


    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()) {
            // CREATE
            case 'POST':
                {
                    return [
                        'main_game_plat_code' => 'required|exists:def_main_game_plats,main_game_plat_code',
                        'cn_name' => 'nullable|min:1|max:64|string',
                        'en_name' => 'nullable|min:1|max:64|string',
                        'pc_game_code' => 'nullable|min:1|max:32|alpha_dash',
                        'pc_game_deputy_code' => 'nullable|min:1|max:32|alpha_dash',
                        'mobile_game_code' => 'nullable|min:1|max:32|alpha_dash',
                        'mobile_game_deputy_code' => 'nullable|min:1|max:32|alpha_dash',
                        'record_match_code' => 'nullable|min:1|max:32|alpha_dash',
                        'record_match_deputy_code' => 'nullable|min:1|max:32|alpha_dash',
                        'category' => 'required|exists:game_categories,code',
                        'type' => 'required|exists:game_types,code',
                        'line_num' => 'nullable|exists:game_lines,code',
                        'money_return_rate' => 'nullable|numeric',
                        'bonus_pool' => 'nullable|numeric',
                        'able_demo' => 'required|in:0,1',
                        'able_recommend' => 'required|in:0,1',
                        'is_lobby' => 'required|in:0,1',
                        'img1' => 'nullable|string',
                        'img2' => 'nullable|string',
                        'status' => 'required|in:0,1,2|numeric'
                    ];
                }
            // UPDATE
            case 'PUT':
            case 'PATCH':
                {
                    return [
                        'main_game_plat_code' => 'required|exists:def_main_game_plats,main_game_plat_code',
                        'cn_name' => 'nullable|min:1|max:64|string',
                        'en_name' => 'nullable|min:1|max:64|string',
                        'pc_game_code' => 'nullable|min:1|max:32|alpha_dash',
                        'pc_game_deputy_code' => 'nullable|min:1|max:32|alpha_dash',
                        'mobile_game_code' => 'nullable|min:1|max:32|alpha_dash',
                        'mobile_game_deputy_code' => 'nullable|min:1|max:32|alpha_dash',
                        'record_match_code' => 'nullable|min:1|max:32|alpha_dash',
                        'record_match_deputy_code' => 'nullable|min:1|max:32|alpha_dash',
                        'category' => 'required|exists:game_categories,code',
                        'type' => 'required|exists:game_types,code',
                        'line_num' => 'nullable|exists:game_lines,code',
                        'money_return_rate' => 'nullable|numeric',
                        'bonus_pool' => 'nullable|numeric',
                        'able_demo' => 'required|in:0,1',
                        'able_recommend' => 'required|in:0,1',
                        'is_lobby' => 'required|in:0,1',
                        'img1' => 'nullable|string',
                        'img2' => 'nullable|string',
                        'status' => 'required|in:0,1,2|numeric'
                    ];
                }
            case 'GET':
            case 'DELETE':
            default:
                {
                    return [];
                };
        }
    }
}
